/**
 * Author:   YASUO
 * Date:     2018/7/21 14:53
 * Description:
 */
package com.rljk.common.consts;

import com.rljk.common.result.CodeMsg;
import com.rljk.exception.GlobalException;

/**
 * 信用积分
 */
public enum CreditScoreEnum {

    VERY_GOOG(200,"信用极好"),
    GOOG(100,"信用一般"),
    BAD(50,"信用不好")
    ;

    private int code;   //信用分数
    private String name;

    CreditScoreEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }


    public static String getName(int code) {
        for (CreditScoreEnum c : CreditScoreEnum.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        throw new GlobalException(CodeMsg.ENUM_NOT_FIND);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
